package com.vtuzx.kingdee.xqc_api.service;

import com.vtuzx.core.VtuzxException;
import com.vtuzx.core.bean.dto.VtuzxMap;
import com.vtuzx.core.bean.dto.VtuzxToken;
import com.vtuzx.web.bean.VtuzxDownloadBean;
import com.vtuzx.web.web.VtuzxControlParam;
import org.bson.Document;
import org.bson.types.ObjectId;
import org.springframework.stereotype.Service;

import java.io.File;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 吉克云
 */
public interface IJiKeYunService {
    /**
     * 极客云付款单
     * @param userId
     * @param param
     * @return
     */
    VtuzxMap getPaymentList(ObjectId userId, Map<String, Object> param,int pageIndex,int pageSize);

    /**
     * 上传付款单到金蝶
     * @param userId
     * @param billNoList
     * @return
     */
    VtuzxMap uploadKingdeePayment(ObjectId userId, List<String> billNoList) throws Exception;

    /**
     * 极客云收款单
     * @param userId
     * @param param
     * @return
     */
    VtuzxMap getCollectionList(ObjectId userId, Map<String, Object> param,int pageIndex,int pageSize);

    /**
     * 上传收款单到金蝶
     * @param userId
     * @param billNoList
     * @return
     */
    VtuzxMap uploadKingdeeCollection(ObjectId userId,String userName, List<String> billNoList) throws Exception;

    /**
     * 极客云公司间结算单
     * @param userId
     * @param param
     * @return
     */
    VtuzxMap getInnersettorderList(ObjectId userId, Map<String, Object> param,int pageIndex,int pageSize);

    /**
     * 极客云公司间销售结算单
     * @param userId
     * @param param
     * @return
     */
    VtuzxMap getInnersettorderSaleList(ObjectId userId, Map<String, Object> param,int pageIndex,int pageSize);


    /**
     * 上传公司间结算单到金蝶
     * @param userId
     * @param billNoList
     * @return
     */
    VtuzxMap uploadKingdeeInnersettorder(ObjectId userId,String userName, List<String> billNoList,String orderTime) throws Exception;

    /**
     * 极客云出库单列表
     * @param userId
     * @param param
     * @return
     */
    VtuzxMap getStorageOutList(ObjectId userId, Map<String, Object> param,int pageIndex,int pageSize);

    /**
     * 上传公极客云出库单到金蝶
     * @param userId
     * @param billNoList
     * @return
     */
    VtuzxMap uploadKingdeeStorageOut(ObjectId userId, List<String> billNoList) throws Exception;

    /**
     * 批量上传金蝶订单
     * @param userId
     * @param userName
     * @param param
     */
    void uploadKingdeeBill(ObjectId userId, String userName, Map<String, Object> param) throws VtuzxException;

    VtuzxMap getjkyAllocation(ObjectId userId, Map<String, Object> param, int pageIndex, int pageSize);

    VtuzxMap getJikeyunSale(ObjectId userId, Map<String, Object> param, int pageIndex, int pageSize);

    /**
     * 上传调拨单到金蝶
     * @param userId
     * @param billNoList
     * @return
     */
    VtuzxMap uploadKingdeeAllocation(ObjectId userId, List<String> billNoList) throws VtuzxException;

    /**
     * 上传销售单到金蝶
     * @param userId
     * @param billNoList
     * @return
     * @throws VtuzxException
     */
    VtuzxMap uploadKingdeeSale(ObjectId userId,String userName, List<String> billNoList,String orderTime) throws VtuzxException;




    /**
     * 获取吉客云销售单(野象)
     * @param userId
     * @param param
     * @param pageIndex
     * @param pageSize
     * @return
     */
    VtuzxMap getJikeyunSaleYX(ObjectId userId, Map<String, Object> param, int pageIndex, int pageSize);

    /**
     * 获取野象收款单
     * @param userId
     * @param param
     * @param pageIndex
     * @param pageSize
     * @return
     */
    VtuzxMap getCollectionListYX(ObjectId userId, Map<String, Object> param, int pageIndex, int pageSize);

    /**
     * 获取野象付款单
     * @param userId
     * @param param
     * @param pageIndex
     * @param pageSize
     * @return
     */
    VtuzxMap getPaymentListYX(ObjectId userId, Map<String, Object> param, int pageIndex, int pageSize);

    /**
     * 导入excle传野象销售单到金蝶
     * @param userId
     * @param name
     * @param file
     */
    void uploadYexiangSaleBill(ObjectId userId, String name, File file,String orderTime) throws Exception;

    /**
     * 导入excle(野象公司间调拨结算单)传金蝶,包含公司间调拨和销售
     * @param userId
     * @param name
     * @param file
     * @throws Exception
     */
    void uploadYexiangInnersetteBill(ObjectId userId, String name, File file,String orderTime) throws Exception;

    /**
     * 导入excle野象收款单传金蝶
     * @param userId
     * @param name
     * @param file
     */
    void uploadYexiangCollectionBill(ObjectId userId, String name, File file)throws Exception;

    /**
     * 导入excle野象付款单传金蝶
     * @param userId
     * @param name
     * @param file
     */
    void uploadYexiangPaymentBill(ObjectId userId, String name, File file)throws Exception;

    /**
     * 导入excle传销售单(包含扣点信息)
     * @param userId
     * @param name
     * @param file
     */
    void uploadYexiangSaleBillPoints(ObjectId userId, String name, File file,String orderTime) throws Exception;

    /**
     * 传光年的网店订单号
     * @param userId
     * @param name
     * @param file
     */
    void uploadGuangnianOnline(ObjectId userId, String name, File file) throws Exception;

    /**
     * 获取价目表
     * @param userId
     * @param param
     * @param pageIndex
     * @param pageSize
     * @return
     */
    VtuzxMap getPriceList(ObjectId userId, Map<String, Object> param, int pageIndex, int pageSize);

    /**
     * 同步价目表
     * @param userId
     * @param name
     * @return
     */
    void syncPriceList(ObjectId userId, String name) throws Exception;

    VtuzxMap getChannelList(ObjectId userId, Map<String, Object> param, int pageIndex, int pageSize);

    void syncChannelList(ObjectId userId, String name)throws Exception;

    void syncWarehouseList(ObjectId userId, String name)throws Exception;

    VtuzxMap syncStorageOut(String goodsdocNo) throws Exception;

    /**
     * 传吉客云调拨单
     * @param userId
     * @param name
     * @param file
     * @param orderTime
     */
//    void uploadJikeyunAllocation(ObjectId userId, String name, File file, String orderTime)throws Exception;

    /**
     * 同步吉客云调拨单(需要从委外仓或者大连总仓往新工厂总仓调拨的调拨单)
     * @param userId
     * @param name
     * @param file
     * @param orderTime
     */
    void downloadJikeyunAllocation(ObjectId userId, String name, File file, String orderTime)throws Exception;

    /**
     * 传调拨单到吉客云
     * @param userId
     * @param dataList
     * @return
     */
    VtuzxMap uploadJikeyunAllocationBill(ObjectId userId,String userName, List<Map<String,Object>> dataList,String type,List<String> allocateNoList) throws Exception;

    /**
     * 获取待同步列表
     */
    VtuzxMap getSyncListLatest(ObjectId userId, Map<String, Object> param, int pageIndex, int pageSize);

    /**
     * 获取已同步列表
     */
    VtuzxMap getSyncListHistory(ObjectId userId, Map<String, Object> param, int pageIndex, int pageSize);

    /**
     * 获取自采品列表
     */
    VtuzxMap getSelfItemList(ObjectId userId, Map<String, Object> param, int pageIndex, int pageSize);

    /**
     * 获取吉客云仓库列表
     */
    VtuzxMap getWarehouseList(ObjectId userId, Map<String, Object> param, int pageIndex, int pageSize);

    /**
     * 根据待同步列表自动同步调拨单
     */
    VtuzxMap syncListAllocationLatest(Date from, Date to);

    /**
     * 根据待同步列表自动同步销售单
     */
    VtuzxMap syncListSaleLatest(Date from, Date to);

    /**
     * 校验并修复数据
     */
    void checkAndFixInconsistentData();

    /**
     * 配置同步时间
     */
    void uploadSyncTime(ObjectId userId, String userName, Map<String, Object> param) throws VtuzxException;

    VtuzxMap getBainianAllocationList(ObjectId userId, Map<String, Object> param, int pageIndex, int pageSize);

    VtuzxMap getBaiNianAllocationDetail(ObjectId userId, List<String> billNoList)throws Exception;

    /**
     * 查询吉客云库存
     */
    Map<String, Object> syncAllocation(String stockNo,List<String> skuNoList,int pageIndex) throws Exception;

    void deleteBainianAllocate(ObjectId userId, String userName, String billNo);

    VtuzxMap createAllocationByAllocation(ObjectId userId, String userName, Map<String, Object> param) throws Exception;

    VtuzxMap getBainianAllocationLogList(ObjectId userId, Map<String, Object> param, int pageIndex, int pageSize);
}
